﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System.IO;
using System.Web;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security;
using System.Threading;
using AISmartEventServer.Model;
namespace AISmartEventServer
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class HzauthEventServer : HzauthEventServerI
    {
        /// <summary>
        ///   机动车
        /// </summary>
        public string GetMotorvehicleList(string captureStartTime = "2020-01-01 00:00:00", string captureEndTime = "2020-12-30 23:59:59")
        {
            //, string hostId = "", int annualTagsLayout = 0, string captureAddress = "", string captureUser = "", string dataSrcTypes = "", int direction = 0, int iannualTags = 0, int imarkerWindows = 0, int ipendant = 0, int ipilotSunvisor = 0, int itissuebox = 0, int iviceSunvisor = 0, string laneName = "", string laneNo = "", int pageNum = 1, int pageSize = 10, int pilotSafeBelt = 1, int plateColor = 1, string plateNo = "", int plateType = 1, string sourceIds = "", int status = 1, int usePhone = 1, string vehicleBrand = "", int vehicleColor = 1, string vehicleModelName = "", string vehicleModelYear = "", string vehicleSpeed = "", string vehicleSubBrand = "", int vehicleType = 1, int vicePilotSafeBelt = 1, string vs900RecordId = ""
            string url = "https://192.168.1.252/api/vsbasic/metadata/motorvehicle/list";

            SetCertificatePolicy();

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "application/json";
            //request.PreAuthenticate = false;
            //request.Headers.Add("Bearer;ce7e4c98-6b16-4040-ba96-52c6977ef4a7");

            //request.Headers.Add(HttpRequestHeader.Authorization, "Bearer ff09f3f6-158f-44bb-84e5-89a80f25ec03");


            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            //CarSearchModel model = new CarSearchModel();
            //model.hostId = hostId;
            //model.annualTagsLayout = annualTagsLayout;
            //model.captureAddress = captureAddress;
            //model.captureStartTime = captureStartTime;
            //model.captureEndTime = captureEndTime;
            //model.captureUser = captureUser;
            //model.dataSrcTypes = dataSrcTypes;
            //model.direction = direction;
            //model.iannualTags = iannualTags;
            //model.imarkerWindows = imarkerWindows;
            //model.ipendant = ipendant;
            //model.ipilotSunvisor = ipilotSunvisor;
            //model.itissuebox = itissuebox;
            //model.iviceSunvisor = iviceSunvisor;
            //model.laneName = laneName;
            //model.laneNo = laneNo;
            //model.pageNum = pageNum;
            //model.pageSize = pageSize;
            //model.pilotSafeBelt = pilotSafeBelt;
            //model.plateColor = plateColor;
            //model.plateNo = plateNo;
            //model.plateType = plateType;
            //model.sourceIds = sourceIds;
            //model.status = status;
            //model.usePhone = usePhone;
            //model.vehicleBrand = vehicleBrand;
            //model.vehicleColor = vehicleColor;
            //model.vehicleModelName = vehicleModelName;
            //model.vehicleModelYear = vehicleModelYear;
            //model.vehicleSpeed = vehicleSpeed;
            //model.vehicleSubBrand = vehicleSubBrand;
            //model.vehicleType = vehicleType;
            //model.vicePilotSafeBelt = vicePilotSafeBelt;
            //model.vs900RecordId = vs900RecordId;

            //string str = Newtonsoft.Json.JsonConvert.SerializeObject(model);

            string strd = @"{""captureStartTime"": """ + captureStartTime + @""",""captureEndTime"": """ + captureEndTime + @"""}";
            //@"{""captureEndTime"": ""2020-12-30 23:59:59"",""captureStartTime"": ""2020-01-01 00:00:00""}
            byte[] byteData = UTF8Encoding.UTF8.GetBytes(strd);
            request.ContentLength = byteData.Length;

            using (Stream postStream = request.GetRequestStream())
            {
                postStream.Write(byteData, 0, byteData.Length);
            }
            MotorvehicleModel Motmodel = new MotorvehicleModel();
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                Console.WriteLine(result);
                resultToken<resultData<MotorvehicleModel>> retoken = Newtonsoft.Json.JsonConvert.DeserializeObject<resultToken<resultData<MotorvehicleModel>>>(result);
                if (retoken.data.list.Count > 0)
                {
                    string filePath = retoken.data.list[0].filePath;
                    string filePathSmall = retoken.data.list[0].filePathSmall;
                    //string url2="https://192.168.1.252/api/storage/vs900/v1/downFileByName?fileName="+filePath;
                    Motmodel = retoken.data.list[0];
                }
            }
            return Motmodel.filePathSmall;
        }

        /// <summary>
        ///   非机动车
        /// </summary>
        public string GetNonMotorvehicleList(string captureStartTime = "2020-01-01 00:00:00", string captureEndTime = "2020-12-30 23:59:59")
        {
            //, int ageGroup = 0, int backPack = 0, string captureAddress = "", string captureUser = "", int coatColor = 0, int coatText = 0, int coatType = 0, string dataSrcTypes = "", string descCtx = "", int faceMask = 0, int gender = 0, int glassType = 0, int glasses = 0, string groupId = "", int hairColor = 0, int hairStyle = 0, int hairType = 0, int handBag = 0, int hat = 0, int helmet = 0, int holdaChild = 0, string illegalCode = "", string laneNo = "", int nostdVehicleType = 0, int orient = 0, int pageNum = 1, int pageSize = 10, int passenger = 1, int passengerNum = 1, int recoFlag = 1, int singlePack = 1, int smoking = 1, string sourceIds = "", int status = 1, int suitcase = 1, int tricycleType = 1, int trousersColor = 1, int trousersType = 1, int umbrella = 1, int usePhone = 1, int vehicleColor = 1, string vehicleModelName = "", int vehicleSpecialType = 1, string vehicleSpeed = "", int vehicleType = 1, string vs900RecordId = ""

            string url = "https://192.168.1.252/api/vsbasic/metadata/nonmotorvehicle/list";

            SetCertificatePolicy();

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "application/json";

            //request.Headers.Add("Bearer;ce7e4c98-6b16-4040-ba96-52c6977ef4a7");ff09f3f6-158f-44bb-84e5-89a80f25ec03

            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            NonMotorVehiclesSearchModel model = new NonMotorVehiclesSearchModel();
            //model.ageGroup = ageGroup;
            //model.backPack = backPack;
            //model.captureAddress = captureAddress;
            //model.captureStartTime = captureStartTime;
            //model.captureEndTime = captureEndTime;
            //model.captureUser = captureUser;
            //model.coatColor = coatColor;
            //model.coatText = coatText;
            //model.coatType = coatType;
            //model.dataSrcTypes = dataSrcTypes;
            //model.descCtx = descCtx;
            //model.faceMask = faceMask;
            //model.gender = gender;
            //model.glasses = glasses;
            //model.glassType = glassType;
            //model.groupId = groupId;
            //model.hairColor = hairColor;
            //model.hairStyle = hairStyle;
            //model.hairType = hairType;
            //model.handBag = handBag;
            //model.hat = hat;
            //model.helmet = helmet;
            //model.holdaChild = holdaChild;
            //model.illegalCode = illegalCode;
            //model.laneNo = laneNo;
            //model.nostdVehicleType = nostdVehicleType;
            //model.orient = orient;
            //model.pageNum = pageNum;
            //model.pageSize = pageSize;
            //model.passenger = passenger;
            //model.passengerNum = passengerNum;
            //model.recoFlag = recoFlag;
            //model.singlePack = singlePack;
            //model.smoking = smoking;
            //model.sourceIds = sourceIds;
            //model.status = status;
            //model.suitcase = suitcase;
            //model.tricycleType = tricycleType;
            //model.trousersColor = trousersColor;
            //model.trousersType = trousersType;
            //model.umbrella = umbrella;
            //model.usePhone = usePhone;
            //model.vehicleColor = vehicleColor;
            //model.vehicleModelName = vehicleModelName;
            //model.vehicleSpecialType = vehicleSpecialType;
            //model.vehicleSpeed = vehicleSpeed;
            //model.vehicleType = vehicleType;
            //model.vs900RecordId = vs900RecordId;

            string str = Newtonsoft.Json.JsonConvert.SerializeObject(model);

            string strd = @"{""captureStartTime"": """ + captureStartTime + @""",""captureEndTime"": """ + captureEndTime + @"""}";
            //@"{""captureEndTime"": ""2020-12-30 23:59:59"",""captureStartTime"": ""2020-01-01 00:00:00""}"
            byte[] byteData = UTF8Encoding.UTF8.GetBytes(strd);
            request.ContentLength = byteData.Length;

            using (Stream postStream = request.GetRequestStream())
            {
                postStream.Write(byteData, 0, byteData.Length);
            }
            NonMotorvehicleModel NonMotmodel = new NonMotorvehicleModel();
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                Console.WriteLine(result);
                resultToken<resultData<NonMotorvehicleModel>> retoken = Newtonsoft.Json.JsonConvert.DeserializeObject<resultToken<resultData<NonMotorvehicleModel>>>(result);
                if (retoken.data.list.Count > 0)
                {
                    string filePath = retoken.data.list[0].filePath;
                    string filePathSmall = retoken.data.list[0].filePathSmall;
                    NonMotmodel = retoken.data.list[0];
                }
            }
            return NonMotmodel.filePathSmall;
        }

        /// <summary>
        ///  行人列表
        /// </summary>
        public void GetPersonList(string captureStartTime = "2020-01-01 00:00:00", string captureEndTime = "2020-12-30 23:59:59", int ageGroup = 1, int backPack = 1, int coatColor = 1, int coatText = 1, int coatType = 1, string dataSrcTypes = "", int faceMask = 1, int gender = 1, int glassType = 1, int glasses = 1, int hairColor = 1, int hairStyle = 1, int hairType = 1, int handBag = 1, int hat = 1, int holdaChild = 1, int orient = 1, int pageNum = 1, int pageSize = 1, int singlePack = 1, int smoking = 1, string sourceIds = "", int suitcase = 1, int trousersColor = 1, int trousersStyle = 1, int trousersType = 1, int umbrella = 1, int usePhone = 1, string vs900RecordId = "")
        {

            string url = "https://192.168.1.252/api/vsbasic/metadata/person/list";

            SetCertificatePolicy();
            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "application/json";
            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);
            PersonSearchModel model = new PersonSearchModel();
            model.ageGroup = ageGroup;
            model.backPack = backPack;
            model.captureStartTime = captureStartTime;
            model.captureEndTime = captureEndTime;
            model.coatColor = coatColor;
            model.coatText = coatText;
            model.coatType = coatType;
            model.dataSrcTypes = dataSrcTypes;
            model.faceMask = faceMask;
            model.gender = gender;
            model.glasses = glasses;
            model.glassType = glassType;
            model.hairColor = hairColor;
            model.hairStyle = hairStyle;
            model.hairType = hairType;
            model.handBag = handBag;
            model.hat = hat;
            model.holdaChild = holdaChild;
            model.orient = orient;
            model.pageNum = pageNum;
            model.pageSize = pageSize;
            model.singlePack = singlePack;
            model.smoking = smoking;
            model.sourceIds = sourceIds;
            model.suitcase = suitcase;
            model.trousersColor = trousersColor;
            model.trousersStyle = trousersStyle;
            model.trousersType = trousersType;
            model.umbrella = umbrella;
            model.usePhone = usePhone;
            model.vs900RecordId = vs900RecordId;
            //model.stringsourceIds = "SN00000000001310017603,SN00000000001310017792";
            //model.pageSize = 10;
            //model.pageNum = 1;
            //model.vs900RecordId = "string";
            string str = Newtonsoft.Json.JsonConvert.SerializeObject(model);

            string strd = @"{""captureStartTime"": """ + captureStartTime + @"""}";
            //@"{""captureEndTime"": ""2020-12-30 23:59:59"",""captureStartTime"": ""2020-01-01 00:00:00""}"
            byte[] byteData = UTF8Encoding.UTF8.GetBytes(strd);
            request.ContentLength = byteData.Length;

            using (Stream postStream = request.GetRequestStream())
            {
                postStream.Write(byteData, 0, byteData.Length);
            }

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                Console.WriteLine(result);
            }

        }

        /// <summary>
        ///   人脸布控
        /// </summary>
        public void GetFaceList(string captureStartTime = "2020-01-01 00:00:00", string captureEndTime = "2020-12-30 23:59:59", string dataSrcTypes = "", int faceAge = 1, int faceAlive = 1, int faceAttractive = 1, int faceConfidence = 1, int faceEyeglass = 1, int faceEyeopened = 1, int faceHeadnod = 1, int faceHeadshake = 1, int faceMotion = 1, int faceMouthopened = 1, int faceRace = 1, int faceRaceScore = 1, int faceSex = 1, int faceSmiling = 1, int faceSunglass = 1, string hostId = "", int pageNum = 1, int pageSize = 1, string sourceIds = "", int status = 1, string vs900RecordId = "")
        {

            string url = "https://192.168.1.252/api/vsbasic/metadata/face/list";

            SetCertificatePolicy();

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "application/json";

            //request.Headers.Add("Bearer;ce7e4c98-6b16-4040-ba96-52c6977ef4a7");ff09f3f6-158f-44bb-84e5-89a80f25ec03

            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            FaceSearchModel model = new FaceSearchModel();
            model.captureEndTime = captureEndTime;
            model.captureStartTime = captureStartTime;
            model.dataSrcTypes = dataSrcTypes;
            model.faceAge = faceAge;
            model.faceAlive = faceAlive;
            model.faceAttractive = faceAttractive;
            model.faceConfidence = faceConfidence;
            model.faceEyeglass = faceEyeglass;
            model.faceEyeopened = faceEyeopened;
            model.faceHeadnod = faceHeadnod;
            model.faceHeadshake = faceHeadshake;
            model.faceMotion = faceMotion;
            model.faceMouthopened = faceMouthopened;
            model.faceRace = faceRace;
            model.faceRaceScore = faceRaceScore;
            model.faceSex = faceSex;
            model.faceSmiling = faceSmiling;
            model.faceSunglass = faceSunglass;
            model.hostId = hostId;
            model.pageNum = pageNum;
            model.pageSize = pageSize;
            model.sourceIds = sourceIds;
            model.status = status;
            model.vs900RecordId = vs900RecordId;

            string str = Newtonsoft.Json.JsonConvert.SerializeObject(model);

            byte[] byteData = UTF8Encoding.UTF8.GetBytes(@"{""captureEndTime"": ""2020-12-30 23:59:59"",""captureStartTime"": ""2020-01-01 00:00:00"",""dataSrcTypes"":""1""}");
            request.ContentLength = byteData.Length;

            using (Stream postStream = request.GetRequestStream())
            {
                postStream.Write(byteData, 0, byteData.Length);
            }

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();

                Console.WriteLine(result);
            }
        }

        static string _SystemToken = "";
        public static string SystemToken
        {
            get
            {
                if (string.IsNullOrEmpty(_SystemToken))
                {
                    Utility.ThreadManager.CloseThread(threadToken);
                    threadToken = new Thread(new ThreadStart(timeGetToken));
                    threadToken.Start();
                    System.Threading.Thread.Sleep(3000);

                }
                return _SystemToken;
            }

        }

        /// <summary>
        /// 创建一个线程用于获取令牌（令牌有有效期）
        /// </summary>
        public static Thread threadToken = new Thread(new ThreadStart(timeGetToken));




        public static void timeGetToken()
        {

            while (true)
            {

                try
                {
                    getToken();

                    //1小时获取一次
                    Thread.Sleep(1 * 60 * 60 * 1000);
                }
                catch
                    (Exception ex)
                {
                    Utility.LogHelper.InstanctLogHelper.WriteLog(" err :" + ex.Message);
                }

            }
        }

        /// <summary>
        ///  令牌获取
        /// </summary>
        public static void getToken()
        {
            string url = "https://192.168.1.252/api/user/v1/account/token?clientId=1300336664865951746&clientSecret=0ec78ea0c450431c83e52003b02045ba";
            SetCertificatePolicy();
            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "POST";
            request.ContentType = "application/json";
            request.Headers.Add(HttpRequestHeader.Authorization, "string");
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                resultToken<resultData> retoken = Newtonsoft.Json.JsonConvert.DeserializeObject<resultToken<resultData>>(result);
                _SystemToken = "Bearer " + retoken.data.accessToken;
                Console.WriteLine(result);
            }

            //{"code":200,"msg":"请求成功","data":{"accessToken":"ff09f3f6-158f-44bb-84e5-89a80f25ec03","expiresIn":21031,"scope":"read"}}
        }
        public static void SetCertificatePolicy()
        {

            ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;
        }
        /// <summary>
        /// Remotes the certificate validate.
        /// </summary>
        private static bool RemoteCertificateValidate(
           object sender, X509Certificate cert,
            X509Chain chain, SslPolicyErrors error)
        {
            // trust any certificate!!!
            System.Console.WriteLine("Warning, trust any certificate");
            return true;
        }

        /// <summary>
        /// 获取车辆历史告警
        /// </summary>
        /// <param name="controlId">布控ID</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="plateNo">车牌号码 模糊查询</param>
        /// <param name="vehicleBrand">车辆品牌名称</param>
        /// <param name="pageNum">分页页码 默认1</param>
        /// <param name="pageSize">每页数量 默认20</param>
        /// <returns></returns>
        public string GetGaojin(string controlId, string startTime, string endTime,string plateNo,string vehicleBrand, int pageNum = 1, int pageSize = 20)
        {
            string url = "https://192.168.1.252/api/vsbasic/alarm/vehicle/list";
            if (!string.IsNullOrEmpty(startTime))
                url += "?startTime=" + startTime;
            if (!string.IsNullOrEmpty(endTime))
                url += "&endTime=" + endTime;

            SetCertificatePolicy();

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "GET";
            request.ContentType = "application/json";


            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            //string strd = @"{""startTime"": """ + startTime + @""",""endTime"": """ + endTime + @"""}";
            ////@"{""captureEndTime"": ""2020-12-30 23:59:59"",""captureStartTime"": ""2020-01-01 00:00:00""}
            //byte[] byteData = UTF8Encoding.UTF8.GetBytes(strd);
            //request.ContentLength = byteData.Length;

            //using (Stream postStream = request.GetRequestStream())
            //{
            //    postStream.Write(byteData, 0, byteData.Length);
            //}

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                //resultToken<data> retoken = Newtonsoft.Json.JsonConvert.DeserializeObject<resultToken<data>>(result);
                Console.WriteLine(result);
                return result;
            }
        }
        /// <summary>
        /// 获取告警数据通道
        /// </summary>
        /// <param name="type">1:车辆告警 2:人脸告警 3:高危车告警（默认1）</param>
        /// <returns></returns>
        public string GetGaojin(int type = 1)
        {
            string url = "https://192.168.1.252/api/vsbasic/alarm/address?type=" + type;

            SetCertificatePolicy();

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "GET";
            request.ContentType = "application/json";


            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
                resultToken<data> retoken = Newtonsoft.Json.JsonConvert.DeserializeObject<resultToken<data>>(result);
                string ip = retoken.data.ip;
                string port = retoken.data.port;
                string path = ip + ":" + port;
                GetGao(path);
                Console.WriteLine(result);
                return ip + ":" + port;
            }
        }
        public void GetGao(string url)
        {
            SetCertificatePolicy();
            url = "https://" + url;
            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            request.Method = "GET";
            request.ContentType = "application/json";


            request.Headers.Add(HttpRequestHeader.Authorization, SystemToken);

            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());
                string result = reader.ReadToEnd();
            }
        }
    }


    /// <summary>
    /// 回执信息
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class resultToken<T>
    {
        public int code { get; set; }
        public string msg { get; set; }
        public T data { get; set; }
    }

    /// <summary>
    /// token结果信息
    /// </summary>
    public class resultData
    {
        public string accessToken { get; set; }
        public int expiresIn { get; set; }
        public string scope { get; set; }
    }

    public class data
    {
        public string ip { get; set; }
        public string port { get; set; }
    }

    /// <summary>
    /// 通用检索结果信息
    /// </summary>
    /// <typeparam name="T">类型</typeparam>
    public class resultData<T>
    {
        //页码
        public int currentPage { get; set; }

        //检索结果信息{
        public List<T> list { get; set; }

        //
        public int recordCount { get; set; }

        public int totalCount { get; set; }

        public int totalPage { get; set; }
    }

    /// <summary>
    /// 人脸检索对象
    /// </summary>
    public class FaceSearchModel
    {
        /// <summary>
        ///   //抓拍时间，结束时间
        /// </summary>
        public string captureEndTime
        { get; set; }

        /// <summary>
        /// 抓拍时间，开始时间
        /// </summary>
        public string captureStartTime
        { get; set; }

        /// <summary>
        ///    //数据来源类型：0:卡口(kk处理) 1:实时流 抓拍机 2:文件 3:录像流 多个以,分割
        ///example: 0,1,2,3
        /// </summary>
        public string dataSrcTypes
        { get; set; }



        /// <summary>
        /// /年龄
        /// </summary>
        public int faceAge
        { get; set; }


        /// <summary>
        /// 活体检测
        /// </summary>
        public int faceAlive
        { get; set; }



        /// <summary>
        ///魅力值 
        /// </summary>
        public int faceAttractive
        { get; set; }

        //置信度
        /// <summary>
        /// 
        /// </summary>
        public int faceConfidence
        { get; set; }


        /// <summary>
        /// 戴眼镜
        /// </summary>
        public int faceEyeglass
        { get; set; }


        /// <summary>
        /// 睁眼
        /// </summary>
        public int faceEyeopened
        { get; set; }


        /// <summary>
        /// 点头
        /// </summary>
        public int faceHeadnod
        { get; set; }


        /// <summary>
        /// 摇头
        /// </summary>
        public int faceHeadshake
        { get; set; }


        /// <summary>
        ///  脸部动作表情
        /// </summary>
        public int faceMotion
        { get; set; }


        /// <summary>
        /// 张嘴
        /// </summary>
        public int faceMouthopened
        { get; set; }


        /// <summary>
        /// 种族分类
        /// </summary>
        public int faceRace
        { get; set; }


        /// <summary>
        /// 种族分类置信度
        /// </summary>
        public int faceRaceScore
        { get; set; }


        /// <summary>
        /// 性别
        /// </summary>
        public int faceSex
        { get; set; }


        /// <summary>
        /// 微笑
        /// </summary>
        public int faceSmiling
        { get; set; }


        /// <summary>
        /// 太阳眼镜
        /// </summary>
        public int faceSunglass
        { get; set; }


        /// <summary>
        /// 主机编/局唯一）
        /// </summary>
        public string hostId
        { get; set; }


        /// <summary>
        /// 分页页码,默认第一页
        /// </summary>
        public int pageNum
        { get; set; }


        /// <summary>
        /// 每页数量,默认每页10条
        /// </summary>
        public int pageSize
        { get; set; }



        /// <summary>
        /// example: SN00000000001310017603,SN00000000001310017792
        ///来源Ids 通道序列号/卡口编号/文件序列号 多个以,分割
        /// </summary>
        public string sourceIds
        { get; set; }

        /// <summary>
        /// 状态：0-正常（默认）、1-告警未确认；2：告警已确认
        /// </summary>
        public int status
        { get; set; }


        /// <summary>
        /// vs900记录ID
        /// </summary>
        public string vs900RecordId
        { get; set; }
    }


    /// <summary>
    /// 机动车检索对象
    /// </summary>
    public class CarSearchModel
    {

        /// <summary>
        /// 年检标粘贴形状（0：纵向；1：横向；2:7字形；3：其他）
        /// </summary>
        public int annualTagsLayout { get; set; }

        /// <summary>
        /// 采集地址
        /// </summary>
        public string captureAddress { get; set; }

        /// <summary>
        /// example: 2020-12-30 23:59:59
        ///抓拍时间，结束时间
        /// </summary>
        public string captureEndTime { get; set; }

        /// <summary>
        /// example: 2020-01-01 00:00:00
        ///抓拍时间，开始时间
        /// </summary>
        public string captureStartTime { get; set; }

        /// <summary>
        /// 采集人姓名
        /// </summary>
        public string captureUser { get; set; }
        /// <summary>
        /// 数据来源类型：0:卡口(kk处理) 1:实时流 抓拍机 2:文件 3:录像流 多个以,分割
        /// example: 0,1,2,3
        /// </summary>
        public string dataSrcTypes { get; set; }

        /// <summary>
        /// 运行方向
        /// </summary>
        public int direction { get; set; }
        /// <summary>
        /// 主机编号（全局唯一）
        /// </summary>
        public string hostId { get; set; }

        /// <summary>
        /// 0-未知，1-无年检标，2-有年检标
        /// </summary>
        public int iannualTags { get; set; }
        /// <summary>
        /// 0-未知，1-无车窗，2-有车窗
        /// </summary>
        public int imarkerWindows { get; set; }

        /// <summary>
        /// 0-未知，1-无挂件，2-有挂件
        /// </summary>
        public int ipendant { get; set; }

        /// <summary>
        /// 0-未知，1-未放下，2-放下
        /// </summary>
        public int ipilotSunvisor { get; set; }

        /// <summary>
        /// 0-未知，1-无纸巾盒，2-有纸巾盒
        /// </summary>
        public int itissuebox { get; set; }

        /// <summary>
        /// 0-未知，1-未放下，2-放下
        /// </summary>
        public int iviceSunvisor { get; set; }

        /// <summary>
        /// 车道名称
        /// </summary>
        public string laneName { get; set; }

        /// <summary>
        /// 车道编号
        /// </summary>
        public string laneNo { get; set; }

        /// <summary>
        /// 分页页码,默认第一页
        /// </summary>
        public int pageNum { get; set; }

        /// <summary>
        /// 每页数量,默认每页10条
        /// </summary>
        public int pageSize { get; set; }

        /// <summary>
        /// 主驾是否系安全带，取值范围：0-表示未知,1-未系,2-系
        /// </summary>
        public int pilotSafeBelt { get; set; }

        /// <summary>
        /// 车牌颜色序号
        /// </summary>
        public int plateColor { get; set; }

        /// <summary>
        /// 车牌号 模糊查询
        /// </summary>
        public string plateNo { get; set; }

        /// <summary>
        /// 车牌类型
        /// </summary>
        public int plateType { get; set; }

        /// <summary>
        /// example: SN00000000001310017603,SN00000000001310017792 
        /// 来源Ids 通道序列号/卡口编号/文件序列号 多个以,分割
        /// </summary>
        public string sourceIds { get; set; }

        /// <summary>
        /// 状态：0-正常（默认）、1-告警未确认；2：告警已确认
        /// </summary>
        public int status { get; set; }

        /// <summary>
        /// 驾驶员是否打手机，取值范围：0-未知，1-未打手机，2-打手机
        /// </summary>
        public int usePhone { get; set; }

        /// <summary>
        /// 车辆品牌（车标）
        /// </summary>
        public string vehicleBrand { get; set; }

        /// <summary>
        /// 车身颜色
        /// </summary>
        public int vehicleColor { get; set; }

        /// <summary>
        /// 车辆款式名称
        /// </summary>
        public string vehicleModelName { get; set; }

        /// <summary>
        /// 车辆年款
        /// </summary>
        public string vehicleModelYear { get; set; }

        /// <summary>
        /// 过车速度
        /// </summary>
        public string vehicleSpeed { get; set; }

        /// <summary>
        /// 车辆子品牌
        /// </summary>
        public string vehicleSubBrand
        { get; set; }

        /// <summary>
        /// 车辆类型
        /// </summary>
        public int vehicleType
        { get; set; }
        /// <summary>
        /// 副驾是否系安全带，取值范围：0-表示未知,1-未系,2-系
        /// </summary>
        public int vicePilotSafeBelt
        { get; set; }

        /// <summary>
        /// vs900记录ID
        /// </summary>
        public string vs900RecordId
        { get; set; }


    }

    /// <summary>
    ///  非机动车检索对象
    /// </summary>
    public class NonMotorVehiclesSearchModel
    {

        /// <summary>
        /// 年龄段
        /// </summary>
        public int ageGroup { get; set; }

        /// <summary>
        /// 双肩包
        /// </summary>
        public int backPack { get; set; }

        /// <summary>
        /// 采集地址
        /// </summary>
        public string captureAddress { get; set; }

        /// <summary>
        /// example: 2020-12-30 23:59:59
        ///抓拍时间，结束时间
        /// </summary>
        public string captureEndTime { get; set; }

        /// <summary>
        /// example: 2020-01-01 00:00:00
        ///抓拍时间，开始时间
        /// </summary>
        public string captureStartTime { get; set; }

        /// <summary>
        /// 采集人姓名
        /// </summary>
        public string captureUser { get; set; }

        /// <summary>
        /// 上衣颜色
        /// </summary>
        public int coatColor { get; set; }

        /// <summary>
        /// 上衣纹理
        /// </summary>
        public int coatText { get; set; }

        /// <summary>
        /// 上衣款式
        /// </summary>
        public int coatType { get; set; }

        /// <summary>
        ///example: 0,1,2,3
        ///数据来源类型：0:卡口(kk处理) 1:实时流 抓拍机 2:文件 3:录像流 多个以,分割
        /// </summary>
        public string dataSrcTypes { get; set; }

        /// <summary>
        /// 描述（透传用）
        /// </summary>
        public string descCtx { get; set; }

        /// <summary>
        /// 戴口罩
        /// </summary>
        public int faceMask { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public int gender { get; set; }

        /// <summary>
        /// 眼镜类型
        /// </summary>
        public int glassType { get; set; }

        /// <summary>
        /// 眼镜
        /// </summary>
        public int glasses { get; set; }

        /// <summary>
        /// 图片组id
        /// </summary>
        public string groupId { get; set; }

        /// <summary>
        /// 头发颜色
        /// </summary>
        public int hairColor { get; set; }

        /// <summary>
        /// 头发样式
        /// </summary>
        public int hairStyle { get; set; }

        /// <summary>
        /// 头发类型长短
        /// </summary>
        public int hairType { get; set; }

        /// <summary>
        /// 手提包
        /// </summary>
        public int handBag { get; set; }

        /// <summary>
        /// 帽子
        /// </summary>
        public int hat { get; set; }

        /// <summary>
        /// 戴头盔
        /// </summary>
        public int helmet { get; set; }

        /// <summary>
        /// 抱小孩
        /// </summary>
        public int holdaChild { get; set; }

        /// <summary>
        /// 违法代码
        /// </summary>
        public string illegalCode { get; set; }

        /// <summary>
        /// 车道编号
        /// </summary>
        public string laneNo { get; set; }

        /// <summary>
        /// 车型种类
        /// </summary>
        public int nostdVehicleType { get; set; }

        /// <summary>
        /// 头部朝向
        /// </summary>
        public int orient { get; set; }

        /// <summary>
        /// 分页页码,默认第一页
        /// </summary>
        public int pageNum { get; set; }

        /// <summary>
        /// 每页数量,默认每页10条
        /// </summary>
        public int pageSize { get; set; }

        /// <summary>
        ///带乘客
        /// </summary>
        public int passenger { get; set; }

        /// <summary>
        /// 乘客数量
        /// </summary>
        public int passengerNum { get; set; }

        /// <summary>
        /// 是否识别
        /// </summary>
        public int recoFlag { get; set; }

        /// <summary>
        /// 单肩包
        /// </summary>
        public int singlePack { get; set; }

        /// <summary>
        /// 抽烟
        /// </summary>
        public int smoking { get; set; }

        /// <summary>
        /// example: SN00000000001310017603,SN00000000001310017792
        ///来源Ids 通道序列号/卡口编号/文件序列号 多个以,分割
        /// </summary>
        public string sourceIds { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int status { get; set; }

        /// <summary>
        /// 拉杆箱
        /// </summary>
        public int suitcase { get; set; }

        /// <summary>
        /// 三轮车类型
        /// </summary>
        public int tricycleType { get; set; }

        /// <summary>
        /// 裤子颜色
        /// </summary>
        public int trousersColor { get; set; }

        /// <summary>
        /// 裤子长短
        /// </summary>
        public int trousersType { get; set; }

        /// <summary>
        /// 打伞
        /// </summary>
        public int umbrella { get; set; }

        /// <summary>
        /// 打电话
        /// </summary>
        public int usePhone { get; set; }

        /// <summary>
        /// 车辆颜色
        /// </summary>
        public int vehicleColor { get; set; }

        /// <summary>
        /// 车辆品牌
        /// </summary>
        public string vehicleModelName { get; set; }

        /// <summary>
        /// 车辆特殊车型
        /// </summary>
        public int vehicleSpecialType { get; set; }

        /// <summary>
        /// 过车速度
        /// </summary>
        public string vehicleSpeed { get; set; }



        /// <summary>
        /// //车辆类型
        /// </summary>
        public int vehicleType { get; set; }


        /// <summary>
        /// //vs900记录ID
        /// </summary>
        public string vs900RecordId
        { get; set; }


    }


    /// <summary>
    /// 行人检索对象
    /// </summary>
    public class PersonSearchModel
    {
        /// <summary>
        /// 年龄段
        /// </summary>
        public int ageGroup
        {
            get;
            set;
        }

        /// <summary>
        /// 双肩包
        /// </summary>
        public int backPack
        {
            get;
            set;
        }

        /// <summary>
        /// example: 2020-12-30 23:59:59
        ///抓拍时间，结束时间
        /// </summary>
        public string captureEndTime
        {
            get;
            set;
        }

        /// <summary>
        /// example: 2020-01-01 00:00:00
        ///抓拍时间，开始时间
        /// </summary>
        public string captureStartTime
        {
            get;
            set;
        }

        /// <summary>
        /// 上衣颜色
        /// </summary>
        public int coatColor
        {
            get;
            set;
        }

        /// <summary>
        /// 上衣纹理
        /// </summary>
        public int coatText
        {
            get;
            set;
        }

        /// <summary>
        /// 上衣款式
        /// </summary>
        public int coatType
        {
            get;
            set;
        }

        /// <summary>
        /// example: 0,1,2,3
        ///数据来源类型：0:卡口(kk处理) 1:实时流 抓拍机 2:文件 3:录像流 多个以,分割
        /// </summary>
        public string dataSrcTypes
        {
            get;
            set;
        }

        /// <summary>
        /// 戴口罩
        /// </summary>
        public int faceMask
        {
            get;
            set;
        }

        /// <summary>
        /// 性别
        /// </summary>
        public int gender
        {
            get;
            set;
        }

        /// <summary>
        /// 眼镜类型
        /// </summary>
        public int glassType
        {
            get;
            set;
        }

        /// <summary>
        /// 眼镜
        /// </summary>
        public int glasses
        {
            get;
            set;
        }

        /// <summary>
        /// 头发颜色
        /// </summary>
        public int hairColor
        {
            get;
            set;
        }

        /// <summary>
        /// 头发样式
        /// </summary>
        public int hairStyle
        {
            get;
            set;
        }

        /// <summary>
        /// 头发类型长短
        /// </summary>
        public int hairType
        {
            get;
            set;
        }

        /// <summary>
        /// 手提包
        /// </summary>
        public int handBag
        {
            get;
            set;
        }

        /// <summary>
        /// 帽子
        /// </summary>
        public int hat
        {
            get;
            set;
        }

        /// <summary>
        /// 抱小孩
        /// </summary>
        public int holdaChild
        {
            get;
            set;
        }

        /// <summary>
        /// 头部朝向
        /// </summary>
        public int orient
        {
            get;
            set;
        }

        /// <summary>
        /// 分页页码,默认第一页
        /// </summary>
        public int pageNum
        {
            get;
            set;
        }

        /// <summary>
        /// 每页数量,默认每页10条
        /// </summary>
        public int pageSize
        {
            get;
            set;
        }

        /// <summary>
        /// 单肩包
        /// </summary>
        public int singlePack
        {
            get;
            set;
        }

        /// <summary>
        /// 抽烟
        /// </summary>
        public int smoking
        {
            get;
            set;
        }

        /// <summary>
        /// example: SN00000000001310017603,SN00000000001310017792
        ///来源Ids 通道序列号/卡口编号/文件序列号 多个以,分割
        /// </summary>
        public string sourceIds
        {
            get;
            set;
        }

        /// <summary>
        /// 拉杆箱
        /// </summary>
        public int suitcase
        {
            get;
            set;
        }

        /// <summary>
        /// 裤子颜色
        /// </summary>
        public int trousersColor
        {
            get;
            set;
        }

        /// <summary>
        /// 裤子款式
        /// </summary>
        public int trousersStyle
        {
            get;
            set;
        }

        /// <summary>
        /// 裤子长短
        /// </summary>
        public int trousersType
        {
            get;
            set;
        }

        /// <summary>
        /// 打伞
        /// </summary>
        public int umbrella
        {
            get;
            set;
        }

        /// <summary>
        /// 打电话
        /// </summary>
        public int usePhone
        {
            get;
            set;
        }

        /// <summary>
        /// vs900记录ID
        /// </summary>
        public string vs900RecordId
        {
            get;
            set;
        }

    }

}